FROM openjdk:8-alpine

WORKDIR /opt

# add pandoc dependency
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
    && apk update \
    && apk add --no-cache --virtual .build-deps wget \
    && wget https://kt-ai-league.oss-cn-beijing.aliyuncs.com/dep/pandoc-3.2.1-linux-amd64.tar.gz \
    && tar -zxf pandoc-3.2.1-linux-amd64.tar.gz \
    && mv pandoc-3.2.1/bin/* /usr/local/bin/ \
    && chmod a+x /usr/local/bin/pandoc && chmod a+x /usr/local/bin/pandoc-server && chmod a+x /usr/local/bin/pandoc-lua \
    && rm -rf * \
    && wget https://kt-ai-league.oss-cn-beijing.aliyuncs.com/dep/apiclient_key.pem \
    && wget https://kt-ai-league.oss-cn-beijing.aliyuncs.com/dep/template_pandoc2.docx \
    && mkdir download \
    && rm -rf /var/cache/apk/* && apk del .build-deps

CMD ["java","-version"]